﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _4.SurfaceOfTriangle
{
    class SurfaceOfTriangle
    {
        static void Main(string[] args)
        {
            Console.WriteLine(   SurfaceOfTriangleByALtitude(a: 5, h: 4));
            Console.WriteLine(  SurfaceOfTriangleByAngle(5, 4, 310) );
            Console.WriteLine(SurfaceOfTriangleByHeron(5, 7, 8));
        }

        private static double SurfaceOfTriangleByALtitude(double a, double h)
        {
            return (a * h) / 2;
        }
        private static double SurfaceOfTriangleByHeron(double a, double b,double c)
        {
            double p = (a + b + c) / 2;
            return Math.Sqrt(p * (p - a)*(p - b)*(p - c));
        }
        private static double SurfaceOfTriangleByAngle(double a, double b, double angle)
        {
            double s = (a * b * Math.Sin(Math.PI * angle / 180)) / 2;
            return s;
        }

    }
}
